
export default ({
    state:{
        isCollapse:false,// 控制菜单展开收起
        tabs:[
            {path:'/home', label:'首页',icon:'HomeFilled'},
        ],//面包屑与顶部tab
        menuList:[]
    },
    getters: {
    },
    mutations:{
    // 控制菜单展开收起
        CollapseMenu(state){
            state.isCollapse = !state.isCollapse
        },
        //添加tab
        ADDTab(state,value){
            if(value.label !== '首页'){
                const index = state.tabs.findIndex(tab => tab.label === value.label)
                if(index === -1){
                    state.tabs.push(value) 
                } 
            }
        },
        // 删除tab
        DeleteTab(state,value){
            const index = state.tabs.findIndex(tab => tab.label === value.label)
            // 根据索引删除tab
            state.tabs.splice(index,1)
        },
        //获取菜单
        GetMenu(state,value){
            state.menuList = value
        }
    },
    actions: {
    },
    modules:{
    }
})
